home *** CD-ROM | disk | FTP | other *** search
GW-BASIC | 1997-01-29 | 4.6 KB | 180 lines |
- 10 'WIRECOND - Maximum number of wires in a conduit - 11 MAR 96 rev. 28 SEP 96
- 20 IF EX$=""THEN EX$="EXIT"
- 30 CLS:KEY OFF
- 40 COLOR 7,0,1
- 50 UL$=STRING$(80,205)
- 60 U1$="##,###.###"
- 70 U2$="##,###"
- 80 I$="conduit inside diameter"
- 90 O$="wire/cable outside diameter"
- 100 N$="number of wires/cables"
- 110 '
- 120 COLOR 15,2
- 130 PRINT " WIRES in CONDUIT";TAB(57)"by George Murphy VE3ERP ";
- 140 COLOR 1,0:PRINT STRING$(80,223);
- 150 COLOR 7,0
- 160 GOSUB 1410 'preface
- 170 PRINT
- 180 COLOR 0,7
- 190 LOCATE ,23
- 200 PRINT " Press 1 to continue or 0 to EXIT..."
- 210 COLOR 7,0
- 220 Z$=INKEY$:IF Z$=""THEN 220
- 230 IF Z$="1"THEN 260
- 240 IF Z$="0"THEN CLS:RUN EX$
- 250 GOTO 220
- 260 VIEW PRINT 3 TO 24:CLS:VIEW PRINT:LOCATE 3
- 270 '
- 280 '.....start
- 290 ID=0:OD=0:NW=0
- 300 ID$="Specified "
- 310 OD$="Specified "
- 320 NW$="Specified "
- 330 PRINT " Enter dimensions in any unit (e.g. inches, millimetres etc.)
- 340 PRINT " The results will be displayed in the same units.
- 350 PRINT
- 360 PRINT " Two of the following factors must be known."
- 370 PRINT " Press number in ( ) to identify the UNKNOWN factor....."
- 380 PRINT UL$;
- 390 PRINT " (1) ";I$
- 400 PRINT " (2) ";O$
- 410 PRINT " (3) ";N$
- 420 Z$=INKEY$:IF Z$=""THEN 420
- 430 IF Z$="1"THEN Y$=I$:GOTO 480
- 440 IF Z$="2"THEN Y$=O$:GOTO 480
- 450 IF Z$="3"THEN Y$=N$:GOTO 480
- 460 GOTO 420
- 470 '
- 480 VIEW PRINT 3 TO 24:CLS:VIEW PRINT:LOCATE 3
- 490 PRINT " To find ";Y$;":"
- 500 PRINT
- 510 IF Y$=I$ OR ID<>0 GOTO 530
- 520 PRINT " ENTER: ";I$;:INPUT ID:GOSUB 590
- 530 IF Y$=O$ OR OD<>0 GOTO 550
- 540 PRINT " ENTER: ";O$;:INPUT OD:GOSUB 590
- 550 IF Y$=N$ OR NW<>0 GOTO 570
- 560 PRINT " ENTER: ";N$;:INPUT NW:GOSUB 590
- 570 GOTO 510
- 580 '
- 590 IF ID*OD<>0 THEN 1000
- 600 IF ID*NW<>0 THEN 1130
- 610 IF OD*NW<>0 THEN 1260
- 620 RETURN
- 630 '
- 640 '.....display results
- 650 VIEW PRINT 3 TO 24:CLS:VIEW PRINT:LOCATE 3
- 660 PRINT TAB(26)"WIRES/CABLES PACKED IN A CONDUIT"
- 670 PRINT TAB(15);STRING$(52,205)"
- 680 PRINT TAB(15)NW$;N$;STRING$(32-LEN(N$),".");USING U2$;NW
- 690 PRINT TAB(15)OD$;O$;STRING$(32-LEN(O$),".");USING U1$;OD
- 700 PRINT TAB(15)ID$;I$;STRING$(32-LEN(I$),".");USING U1$;ID
- 710 PRINT
- 720 PRINT TAB(5)"* ";Y$;" includes packing clearance allowances."
- 730 PRINT UL$;
- 740 PRINT
- 750 COLOR 15,4
- 760 LOCATE ,31:PRINT " KEYTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENCLOSE "
- 770 LOCATE ,31:PRINT " OPEN W A R N I N G OPEN "
- 780 LOCATE ,31:PRINT " SCREENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENLOAD "
- 790 COLOR 7,0
- 800 PRINT
- 810 T=7
- 820 PRINT TAB(T);
- 830 PRINT "The overriding factor governing the maximum number of conductors"
- 840 PRINT TAB(T);
- 850 PRINT "in a conduit is the danger of fire due to heat build-up caused by"
- 860 PRINT TAB(T);
- 870 PRINT "current flow through the conductors."
- 880 PRINT
- 890 COLOR 12
- 900 PRINT TAB(T);
- 910 PRINT "The maximum number of conductors allowed by your local Electrical"
- 920 PRINT TAB(T);
- 930 PRINT "Codes may be less than the maximum number of conductors that will"
- 940 PRINT TAB(T);
- 950 PRINT "physically fit into the conduit."
- 960 COLOR 7
- 970 GOTO 1620
- 980 END
- 990 '
- 1000 '.....Conduit ID (D) and wire OD known
- 1010 VIEW PRINT 3 TO 24:CLS:VIEW PRINT:LOCATE 3:GOSUB 1380
- 1020 N=0:NW$="Maximum * "
- 1030 N=N+0.01 'number of complete layers
- 1040 W=3*N^2+3*N+1:D=(2*N+1)*OD:GOSUB 1090
- 1050 W=3*N^2+5*N+2:D=(2*N+2)*OD:GOSUB 1090
- 1060 W=3*N^2+6*N+3:D=(1+2*SQR(N^2+N+1/3))*OD:GOSUB 1090
- 1070 W=3*N^2+7*N+4:D=(1+SQR(4*N^2+5.644*N+2))*OD:GOSUB 1090
- 1080 GOTO 1030
- 1090 IF D>=ID THEN 640
- 1100 NW=W
- 1110 RETURN
- 1120 '
- 1130 '.....Conduit ID (ID) and number of wires (NW) known
- 1140 VIEW PRINT 3 TO 24:CLS:VIEW PRINT:LOCATE 3:GOSUB 1380
- 1150 N=0:OD$="Maximum * "
- 1160 N=N+0.01 'number of complete layers
- 1170 W=3*N^2+3*N+1:WD=ID/(2*N+1):GOSUB 1220
- 1180 W=3*N^2+5*N+2:WD=ID/(2*N+2):GOSUB 1220
- 1190 W=3*N^2+6*N+3:WD=ID/(1+2*SQR(N^2+N+1/3)):GOSUB 1220
- 1200 W=3*N^2+7*N+4:WD=ID/(1+SQR(4*N^2+5.644*N+2)):GOSUB 1220
- 1210 GOTO 1160
- 1220 IF W>=NW THEN 640
- 1230 OD=WD
- 1240 RETURN
- 1250 '
- 1260 '.....Wire OD (OD) and number of wires (NW) known
- 1270 VIEW PRINT 3 TO 24:CLS:VIEW PRINT:LOCATE 3:GOSUB 1380
- 1280 N=0:ID$="Minimum * "
- 1290 N=N+1 'number of complete layers
- 1300 W=3*N^2+3*N+1:WD=(2*N+1)*OD:GOSUB 1350
- 1310 W=3*N^2+5*N+2:WD=(2*N+2)*OD:GOSUB 1350
- 1320 W=3*N^2+6*N+3:WD=(1+2*SQR(N^2+N+1/3))*OD:GOSUB 1350
- 1330 W=3*N^2+7*N+4:WD=(1+SQR(4*N^2+5.644*N+2))*OD:GOSUB 1350
- 1340 GOTO 1290
- 1350 IF W>=NW THEN ID=2*SQR(((WD/2)^2)*1.02):GOTO 640
- 1360 RETURN
- 1370 '
- 1380 PRINT " CALCULATING BY ITERATION - PLEASE WAIT...."
- 1390 RETURN
- 1400 '
- 1410 '.....preface
- 1420 T=8
- 1430 PRINT TAB(T);
- 1440 PRINT "This program computes the geometry of a circle enclosing a given"
- 1450 PRINT TAB(T);
- 1460 PRINT "number of smaller circles all of the same size, such as a conduit"
- 1470 PRINT TAB(T);
- 1480 PRINT "or hole surrounding a number of same-size wires or cables."
- 1490 PRINT
- 1500 PRINT TAB(T);
- 1510 PRINT "The calculations are based on formulae published in Machinery's"
- 1520 PRINT TAB(T);
- 1530 PRINT "Handbook, Revised 21st Edition, pages 86-87, adjusted to provide"
- 1540 PRINT TAB(T);
- 1550 PRINT "clearances to ease the near-impossible task of trying to pack the"
- 1560 PRINT TAB(T);
- 1570 PRINT "theoretical maximum number of wires into any appreciable length"
- 1580 PRINT TAB(T);
- 1590 PRINT "of conduit."
- 1600 RETURN
- 1610 '
- 1620 '.....end
- 1630 GOSUB 1670
- 1640 CLS:GOTO 120
- 1650 END
- 1660 '
- 1670 'HARDCOPY
- 1680 GOSUB 1790:LOCATE 25,2:COLOR 14,6
- 1690 PRINT " Press 1 to print screen, 2 to print screen & ";
- 1700 PRINT "advance paper, or 3 to continue.";:COLOR 7,0
- 1710 Z$=INKEY$:IF Z$="3"THEN GOSUB 1790:RETURN
- 1720 IF Z$="1"OR Z$="2"THEN GOSUB 1790:GOTO 1740
- 1730 GOTO 1710
- 1740 FOR QX=1 TO 24:FOR QY=1 TO 80
- 1750 LPRINT CHR$(SCREEN(QX,QY));
- 1760 NEXT QY:NEXT QX
- 1770 IF Z$="2"THEN LPRINT CHR$(12)
- 1780 GOTO 1680
- 1790 LOCATE 25,1:PRINT STRING$(80,32);:RETURN
-